Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a markdown “legacy spec” document and wires RSpec up to execute all spec examples as tests, replacing the existing example-file conversion suite.
Changes:
- Add
spec/kramdown_rpf-legacy-spec.mdand a parser-driven RSpec suite to run each```exampleblock as a test. - Add an HTML structural matcher + diff output helper in
spec_helper. - Skip the old
examples/-based conversion tests and update CI/README to run against the spec file.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/specification_spec.rb | New spec runner that parses the spec markdown and generates RSpec examples. |
| spec/spec_helper.rb | Adds HTML comparison matcher/diff utilities and shared Kramdown options. |
| spec/kramdown_rpf_spec.rb | Reorders conversion fixtures and skips the conversion suite in favor of spec-driven tests. |
| spec/kramdown_rpf-legacy-spec.md | Adds the formal legacy specification (inputs + expected HTML). |
| spec/i18n_spec.rb | Uses an around hook to restore locale after each locale context. |
| README.md | Documents running the spec-based tests and overriding the spec file via SPEC_MD. |
| Gemfile | Adds new dev dependencies for spec-based HTML comparison. |
| .github/workflows/ci.yml | Sets SPEC_MD in CI when running specs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+155
to
+156
| **If you add or change examples in `examples/`, you must update the spec file accordingly** — both here in `spec/kramdown_rpf-v0-spec.md` and in the canonical copy in the [documentation repository](https://github.com/RaspberryPiFoundation/documentation) at `docs/technology/codebases-and-products/raspberry-flavoured-markdown/kramdown_rpf-legacy-spec.md`. | ||
|
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed
Spec-driven test suite
Adds a formal spec document and test runner so the Ruby renderer can be validated against canonical examples.
spec/kramdown_rpf-legacy-spec.md— the legacy spec for kramdown-rpf, covering all supported block types (hint, hints, task, challenge, code, collapse, save, new-page, no-print, print-only, quiz, knowledge quiz, microbit, scratch). Each example shows the markdown input and expected HTML output, separated by a·middle dot. The spec is also published in the documentation repo as the canonical human-readable reference.spec/specification_spec.rb— RSpec suite that parses the spec at load time and generates nesteddescribe/context/itblocks, one per example. Runs viaSPEC_MD=spec/kramdown_rpf-legacy-spec.md bundle exec rake spec. TheSPEC_MDenv var defaults to the local spec path so CI requires no extra setup.CI
.github/workflows/ci.yml— spec tests are now run as part of thetestjob, using the spec bundled in this repo. Previously the job attempted tocurlthe spec from the private documentation repo (which required a PAT); the spec is now versioned here directly.README
spec/kramdown_rpf-legacy-spec.mdmust be kept in sync with the copy in the documentation repo when examples change.Test results
I've marked the legacy test blocks as "skip".
202 examples, 0 failures, 30 skipped